//设置响应头的中间件
module.exports =async (ctx,next)=>{
    //设置响应体为json utf-8的格式
    const contentType = "application/json;charset=utf-8"
    //设置响应头ctx.set()
    ctx.set("Content-Type",contentType)
    //开启跨域
    ctx.set("Access-Control-Allow-Origin","*")
    ctx.set("Access-control-Allow-Methods","OPTIONS,GET,PUT,POST,DELETE")
    //设置响应体
    ctx.response.body='{"success":true}'
    await next()
}